<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"><title>系统数据快照</title>
<head th:replace="common/incHead :: incHead"></head>
<body class="gray-bg">
<div class="ok-body">
    <form class="layui-form layui-form-pane" lay-filter="pagerForm" id="pagerForm" action="/base/database/snapshot" method="get">
        <input type="hidden" id="pageNum" name="pageNum" value="1"/>
        <input type="hidden" name="numPerPage" th:value="${page?.numPerPage}"/>
        <input type="hidden" name="orderField" th:value="${orderField}"/>
        <input type="hidden" name="orderDirection" th:value="${orderDirection}"/>
        <div class="layui-row pa-condition">
            <div class="layui-row">
                <div th:replace="common/plugin :: pa-input-cond('ts','开始时间','layui-col-md2',${ts})"></div>
                <div th:replace="common/plugin :: pa-input-cond('te','结束时间','layui-col-md2',${te})"></div>
                <div th:replace="common/plugin :: pa-input-cond('id','自增ID','layui-col-md2',${id})"></div>
                <div th:replace="common/plugin :: pa-input-cond('dbSpace','数据库','layui-col-md2',${dbSpace})"></div>
                <div th:replace="common/plugin :: pa-input-cond('snapshotDay','快照日期','layui-col-md2',${snapshotDay})"></div>
                <div th:replace="common/plugin :: pa-input-cond('sourceTable','来源表','layui-col-md2',${sourceTable})"></div>
                <div th:replace="common/plugin :: pa-input-cond('savePath','保存路径','layui-col-md2',${savePath})"></div>
                <div th:replace="common/plugin :: pa-input-cond('remark','备注信息','layui-col-md2',${remark})"></div>
                <button class="layui-btn layui-btn-sm layui-btn-primary pull-right m-l-xs" title="重置数据" type="reset"><i class="layui-icon layui-icon-return"></i>重置</button>
                <button class="layui-btn layui-btn-sm layui-btn-normal pull-right btnPagerForm" title="重新检索"><i class="layui-icon layui-icon-search"></i>重新检索</button>
            </div>
        </div>
    </form>
    <div class="layui-row ljLayTableBox m-b-xl">
        <table class="layui-hide" id="indexTable" lay-filter="indexTable"></table>
    </div>
</div>
<div th:replace="common/incBottom :: incBottom"></div>
<div th:replace="common/incPage :: incPage"></div>
<!-- 初始化表格数据 -->
<script th:inline="javascript">
    /*<![CDATA[*/
    let indexData = [];
    let initSort = {
        field: [[${orderField}]] || 'id',
        type: [[${orderDirection}]] || 'desc'
    };
    /*[# th:each="item,itemStat:${records}"]*/
    indexData.push({
        id: [[${item.id}]],

        dbSpace: [[${item.dbSpace}]],

        snapshotDay: [[${item.snapshotDay}]],

        sourceTable: [[${item.sourceTable}]],

        savePath: [[${item.savePath}]],

        remark: [[${item.remark}]],

        dataStatus: [[${item.dataStatus}]],
        createTime: [[${@lj.date(item.createTime)}]]
    });
    /*[/]*/
    /*]]>*/
</script>
<script th:inline="none">
    layui.use(["jquery", "table", "okLayer", "okPapper", "okUtils"], function () {
        let table = layui.table;
        let okPapper = layui.okPapper;
        let $ = layui.jquery;
        let okUtils = layui.okUtils;
        let config = okUtils.local("okConfig") || okConfig || {};
        table.render({
            elem: '#indexTable',
            id: 'indexTable',
            height: 'full-158',
            page: false,
            data: indexData,
            limit: indexData.length,
            toolbar: true,
            toolbar: "#toolbarTpl",
            size: config.tableSize,
            cols: [[
                {type: "checkbox", fixed: "left"},
                {field: "id", title: "自增ID", fixed: "left", width: 100, sort: true},

                {field: "dbSpace", title: "数据库", width: 150},

                {field: "snapshotDay", title: "快照日期", width: 150},

                {field: "sourceTable", title: "来源表", width: 150},

                {field: "savePath", title: "保存路径", width: 150},

                {field: "remark", title: "备注信息", width: 150},

                {field: "dataStatus", title: "数据状态", align: "center", width: 90, templet: "#DataStatusTpl"},
                {field: "createTime", title: "添加时间", width: 150},
                {title: "操作", width: 220, align: "center", fixed: "right", templet: "#operationTpl"}
            ]],
            done: function (res, curr, count) {
            }
        });
        table.on('sort(indexTable)', function (obj) {
            $("input[name='orderField']").val(obj.field);
            $("input[name='orderDirection']").val(obj.type);
            $("#pagerForm").submit();
        });
        okPapper.init();
        okLoading.close($);
    })
</script>
<div th:replace="common/plugin :: pa-input-datatime('ts,te')"></div>
<!-- 头工具栏模板 -->
<script type="text/html" id="toolbarTpl">
    <div class="layui-btn-container">
        <button th:if="${@lj.limit('BaseDatabaseSnapshotAdd')>0}" class="layui-btn layui-btn-sm layui-btn-normal" title="系统数据快照新增" refTable="indexTable" ljUrl="/base/database/snapshot/add" target="ljOpenSubmit" ljWidth="800px" ljHeight="600px">
            <i class="layui-icon layui-icon-add-circle"></i>添加系统数据快照
        </button>
    </div>
</script>
<!-- 默认统一操作模板 -->
<script type="text/html" id="operationTpl">
    <button th:if="${@lj.limit('BaseDatabaseSnapshotEdit')>0}" class="layui-btn layui-btn-xs" title="系统数据快照编辑:{{d.id}}" ljUrl="/base/database/snapshot/edit?id={{d.id}}" ljWidth="800px" target="ljOpenSubmit"><i class="layui-icon layui-icon-edit"></i>编辑</button>
    <button th:if="${@lj.limit('BaseDatabaseSnapshotDetail')>0}" class="layui-btn layui-btn-xs layui-btn-normal" title="系统数据快照详情:{{d.id}}" ljUrl="/base/database/snapshot/detail?id={{d.id}}" target="ljOpenCon"><i class="layui-icon layui-icon-form"></i>详情</button>
    <button th:if="${@lj.limit('BaseDatabaseSnapshotDel')>0}" class="layui-btn layui-btn-xs layui-btn-danger" title="确认要删除该系统数据快照吗?" ljUrl="/base/database/snapshot/del?id={{d.id}}" target="ljAjaxTodo"><i class="layui-icon layui-icon-delete"></i>删除</button>
</script>
<!-- DataStatus枚举模板 -->
<div th:replace="common/enum :: pa_enum_DataStatus"></div>
</body>
</html>